<template>
  <h1>--新闻列表展示--</h1>
  <table border="1" cellspacing="0" cellpadding="0" width="800" style="margin: 0 auto;">
    <tr>
        <th>编号</th>
        <th>新闻标题</th>
        <th>新闻内容</th>
        <th>发布时间</th>
        <th>作者</th>
    </tr>
    <tr v-for="i in newslist" :key="i.id">
        <td>{{i.id}}</td>
        <td>{{i.title}}</td>
        <td>{{i.conent}}</td>
        <td>{{i.pub_time}}</td>
        <td>{{i.auther}}</td>
    </tr>
  </table>
</template>

<script>
import axios from 'axios'


export default {
    name:'newview',
    data(){
        return{
            newslist:[]
        }
    },

    mounted () {
        axios.get('http://127.0.0.1:8000/news/news/').then((result) => {
            console.log(result);
            this.newslist = result.data
        }).catch((err) => {
            console.log(err);
        });
    },
}
</script>

<style>

</style>